#include <system.h>

unsigned char *memcpy(unsigned char *dest, const unsigned char *src, const int count) {
   int i;
   for (i=0; i<count; i++) {
      dest[i] = src[i];
   }
   return dest;
}

unsigned char *memset(unsigned char *dest, const unsigned char val, const int count) {
   int i;
   for (i=0; i<count; i++) {
      dest[i] = val;
   }
   return dest;
}

unsigned short *memsetw(unsigned short *dest, const unsigned short val, const int count) {
   int i;
   for (i=0; i<count; i++) {
      dest[i] = val;
   }
   return dest;
}

unsigned char inportb(unsigned short _port) {
   unsigned char rv;
   __asm__ __volatile__ ("inb %1, %0" : "=a" (rv) : "dN" (_port));
   return rv;
}

void outportb(unsigned short _port, unsigned char _data) {
   __asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data));
}

